//
//  NewFeatureViewController.m
//  GoBigMarket
//
//  Created by 王天义 on 16/9/8.
//  Copyright © 2016年 legend. All rights reserved.
//

#import "NewFeatureViewController.h"
#import "SDCycleScrollView.h"
#import "WelcomViewController.h"

@interface NewFeatureViewController ()<SDCycleScrollViewDelegate>

@end

@implementation NewFeatureViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // 采用本地图片实现
    NSArray *imageNames = @[
                            @"私人商场.png",
                            @"智能定位.png",
                            @"价格实惠.png"
                            // 本地图片请填写全名
                            ];
    //
    // 本地加载 --- 创建不带标题的图片轮播器
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 64, XNWindowWidth, (XNWindowHeight - 64 - 49) / 3) shouldInfiniteLoop:YES imageNamesGroup:imageNames];
    cycleScrollView.backgroundColor = [UIColor whiteColor];
    cycleScrollView.delegate = self;
//    cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
    cycleScrollView.showPageControl = NO;  //是否有圆点
    cycleScrollView.infiniteLoop = NO; //是否无限循环
    cycleScrollView.autoScroll = NO; //是否自动滚动
    cycleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    cycleScrollView.tag = 0;
    self.view = cycleScrollView;

}

#pragma mark - SDCycleScrollViewDelegate

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    if (index == 2) {


        //获取Main.storyboard中的首页
        UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        UITabBarController *tabBar = [mainStory instantiateViewControllerWithIdentifier:@"tabBarId"];
        self.view.window.rootViewController = tabBar;
        
        NSUserDefaults *account = [NSUserDefaults standardUserDefaults];
        [account setObject:@"未登录" forKey:LOGIN_STATUS];
        [account synchronize];
        
//        WelcomViewController *welcomeVC = [[WelcomViewController alloc]init];
//        UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:welcomeVC];
        
        //获取窗口,然后设置要跳转的控制器
//        [UIApplication sharedApplication].keyWindow.rootViewController = nav;
    }
}




@end
